﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UITest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        Point p;
        bool drag = false;
        private void panel1_MouseDown(object sender, MouseEventArgs e)
        {
            //p = new Point(e.X, e.Y);
            p = Cursor.Position;
            //drag = true;
        }

        private void panel1_MouseMove(object sender, MouseEventArgs e)
        {
            if (drag)
            {
                Point temp = Cursor.Position;
                this.Location = new Point(this.Location.X + (temp.X-p.X), this.Location.Y + (temp.Y-p.Y));
                p = temp;
            }
        }

        private void panel1_MouseUp(object sender, MouseEventArgs e)
        {
            drag = false;
        }

        private void mainPanel1_Paint(object sender, PaintEventArgs e)
        {
     
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //DrawBord();
        }
        private void DrawBord()
        {
            Graphics g = this.CreateGraphics();
            Pen p = new System.Drawing.Pen(Color.Red, 5);
            g.DrawLine(p, new Point(1, 1), new Point(1, this.Height));
            g.Dispose();
            p.Dispose();
        }

        private void metroButton1_Click(object sender, EventArgs e)
        {
            Form2 f=new Form2();
            f.Show();
        }
        
        private void metroButton2_Click(object sender, EventArgs e)
        {
            alertLabel1.Text = "这是有一个提示";
            alertLabel1.Visible = true;
        }
    }
}
